﻿<UserControl x:Class="Clancy.Ui.Controls.Monitor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:design="clr-namespace:Clancy.Ui.ViewModels.Design"
             mc:Ignorable="d"
             d:DataContext="{d:DesignInstance design:MonitorViewModelMock, IsDesignTimeCreatable=True}"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Border BorderBrush="Black" Background="{Binding BackgroundColor}" BorderThickness="1" CornerRadius="4" Padding="5">

            <DockPanel LastChildFill="true">

                <Grid DockPanel.Dock="Bottom">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="60" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="22" />
                        <RowDefinition Height="22" />
                        <RowDefinition Height="22" />
                    </Grid.RowDefinitions>

                    <Grid.ContextMenu>
                        <ContextMenu>
                            <MenuItem Command="{Binding CmdShowAdvanceProperties}" Header="Show video source properties" />
                        </ContextMenu>
                    </Grid.ContextMenu>

                    <Label Content="Motion:" Grid.Column="0" Grid.Row="0" FontSize="11" Foreground="White" />
                    <Label Content="Threshold:" Grid.Column="0" Grid.Row="1" FontSize="11" Foreground="White" />
                    <Label Content="Framerate:" Grid.Column="0" Grid.Row="2" FontSize="11" Foreground="White" />
                    <Label Content="Movement:" Grid.Column="2" Grid.Row="2" FontSize="11" Foreground="White" />

                    <ProgressBar x:Name="CurrentMotionBar" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="3" Height="6" Maximum="1" Minimum="0" Value="{Binding FrameDifference, Mode=OneWay}" />
                    <ProgressBar x:Name="MotionThresholdBar" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" Height="6" Maximum="100" Minimum="0" Value="{Binding Threshold, Mode=OneWay}" />

                    <Label Content="{Binding FramesPerSecond, Mode=OneWay}" ContentStringFormat="N" Grid.Column="1" Grid.Row="2" FontSize="11" Foreground="White" />
                    <Label Content="{Binding FrameDifference, Mode=OneWay}" ContentStringFormat="P2" Grid.Column="3" Grid.Row="2" FontSize="11" Foreground="White" />
                </Grid>

                <Border BorderBrush="White" BorderThickness="1" Margin="0,0,0,5" CornerRadius="2" Background="Black">
                    <Image Source="{Binding CurrentFrame}" />
                </Border>
            </DockPanel>
        </Border>
    </Grid>
</UserControl>